/**************************************************************************//**
 * @item     CosyOS Kernel
 * @file     os_var.h
 * @brief    系统全局变量声明
 * @author   迟凯峰
 * @version  V3.3.3
 * @date     2023.09.12
 ******************************************************************************/

#ifndef __OS_VAR_H
#define __OS_VAR_H
#include "os_redef.h"

/* The Soft-RTC */
#if SYSCFG_SOFTRTC == __ENABLED__
extern  volatile  tsEvery             _SYS_MEM_   vEvery;
#define sEvent_Every vEvery
extern            u8                  _SYS_MEM_   vRealTime[7];
extern            u8                  _SYS_MEM_   vMonth2Date;
extern  const     u8                _CONST_MEM_   cMonthDate[13];
#endif
/* The Task */
extern  volatile  tBIT                            vRET_f;
extern  volatile  tBIT                            vScheduling_f;
extern            tTimeSharing        _SYS_MEM_   vTickCounter;
extern            tECODE              _SYS_MEM_   vACTRET;
extern            tspTaskHandle       _SYS_MEM_   vACTBUF;
extern            tspTaskNode         _SYS_MEM_   vTASKING;
extern            tspTaskNode         _SYS_MEM_   vTPLTAIL;
extern            tDelay                          vDELAY_STMR [OS_TASKTOTAL + 1];
#if SYSCFG_SAFERUNTIME == __ENABLED__
extern            bool                            vOVERTIME   [OS_TASKTOTAL + 1];
#endif
#if SYSCFG_TIMESHARINGMODE == 2
extern  const     tTimeSharing      _CONST_MEM_   vTIMESHARING[SYSCFG_TASKPRIORITY];
#endif
/* The Timing Interrupt-Task/Hook */
#if OS_TIMINTTOTAL
extern            bool                            vTIMINT_ARLD[OS_TIMINTTOTAL];
extern            bool                            vTIMINT_TYPE[OS_TIMINTTOTAL];
extern            tspTimIntHandle                 vTIMINT_THDL[OS_TIMINTTOTAL];
extern            tTimInt                         vTIMINT_STMR[OS_TIMINTTOTAL];
extern            tTimInt                         vTIMINT_BUFF[OS_TIMINTTOTAL];
#endif
/* The Timing Query-Task/Hook */
#if OS_TIMQRYTOTAL
extern            bool                            vTIMQRY_ARLD[OS_TIMQRYTOTAL];
extern            bool                            vTIMQRY_TYPE[OS_TIMQRYTOTAL];
extern            tspTimQryHandle                 vTIMQRY_THDL[OS_TIMQRYTOTAL];
extern            tTimQry                         vTIMQRY_STMR[OS_TIMQRYTOTAL];
extern            tTimQry                         vTIMQRY_BUFF[OS_TIMQRYTOTAL];
#endif
/* The Global Variable */
extern            tspVarNode          _SYS_MEM_   vVarNode;
#if SYSCFG_MCUCORE == 8051
extern  volatile  tBIT  os_sign_write_var_write;
#endif
/* The Message Mailbox */
#if SYSCFG_MAILBOX == __ENABLED__
extern            tspMbxNode          _SYS_MEM_   vMbxNode;
#if SYSCFG_MCUCORE == 8051
extern  volatile  tBIT  os_sign_write_mbx_write;
#endif
#endif
/* The Direct Message */
#if SYSCFG_DIRMSG == __ENABLED__
extern  volatile  tBIT                            vSendDM_f;
#endif
/* The Debug Interface */
#if SYSCFG_DEBUGGING == __ENABLED__
extern            tsAlarm                         vAlarm;
#define sEvent_Alarm vAlarm
extern            tsFault                         vFault;
#define sEvent_Fault vFault
extern            char              _DEBUG_MEM_   vDebugRecvBuff[OS_DEBUGRECVBUFFSIZE];
extern            char _DEBUG_MEM_ *              vDebugRecvPtr;
extern  volatile  u8                              vDebugSendFlag;
#define CmdlineSendFlag  0x01
#define TaskmgrSendFlag  0x02
extern            char _DEBUG_MEM_ *              vDebugSendPtr;
extern            char              _DEBUG_MEM_   vCmdLineSendBuff[OS_CMDLINESENDBUFFSIZE];
extern            char              _DEBUG_MEM_   vTaskmgrSendBuff[OS_TASKMGRSENDBUFFSIZE];
extern  volatile  bool                            vTaskmgrBinary;
#if SYSCFG_STKTIMECOUNT == __ENABLED__
extern            u32                             vSTK_Counter1;
extern            u32                             vSTK_Counter2;
#endif
#if SYSCFG_TASKPCMONITOR == __ENABLED__
extern            tPC                             vPC;
#endif
#endif
/* The Task Critical */
#if SYSCFG_TASKCRITICAL == __ENABLED__
extern  volatile  u8                  _SYS_MEM_   vTaskCritical;
#endif

#endif
